<?php

require_once '../app/core/models/BaseDao.php';
require_once '../app/core/db/DBUtil.class.php';

class ProfitRatioDao extends BaseDao {
	
	private $tableName = "profit_ratios";
	
	public function getProfitByItemIdAndType($itemId, $ratioType){
		$params = array($itemId, $ratioType);
		$sql = "select pr.* from profit_ratios pr  
				join category_products cp on cp.category_id = pr.category_id  
				join product_items pis on pis.product_id = cp.product_id  
				where pis.id = ? and pr.ratio_type = ? and pr.status = 1 and pr.is_delete = 0   ";
        return $this->dbUtil->SelectData($sql, $params);
	}
	
}
